<template>
    <div class="top-tab">
        <ul>
            <li @click="turn(item)" v-for="(item,index) in items" :key="index">
                <img :src="imgUrl+item.logo" alt="">
                <span class="name">{{item.name}}</span>
            </li>
        </ul>
    </div>
</template>

<script>
    import {click} from "../../api/home";
    import * as ToastUtil from '../../cubeui/toast'
    export default {
        name: "index",
        props:{
            items:{
                type:Array
            }
        },
        data(){
            return {

            }
        },
        methods:{
            turn(item){
                click(item.id).then(res=>{
                    window.location.href = item.url
                }).catch(error=>{
                    ToastUtil.showErrorToast("系统异常,找管理员"+error)
                })

            }
        },
        computed:{
            imgUrl(){
                return process.env.VUE_APP_IMG_URL
            }
        }
    }
</script>

<style type="text/stylus" lang="stylus">
    .top-tab
        background-color white
        ul
          li
            font-size 0
            display inline-block
            width 25%
            text-align center
            padding 10px 0
            img
                margin 0 auto
                margin-bottom 10px
                display block
                width 40px
                border-radius 50%
                height 40px
            .name
                font-size 12px
                font-weight 350



</style>
